package com.shen.blogadmin.controller;


import com.shen.blogadmin.model.params.PageParam;
import com.shen.blogadmin.pojo.Permission;
import com.shen.blogadmin.service.PermissionService;
import com.shen.blogadmin.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.util.resources.ga.LocaleNames_ga;

@RestController
@RequestMapping("admin")
public class AdminController {


    @Autowired
    private PermissionService permissionService;


    @PostMapping("permission/permissionList")
    public Result ListPermission(@RequestBody PageParam pageParam){
        return permissionService.ListPermission(pageParam);
    }

    @PostMapping("/permission/add")
    public Result add(@RequestBody Permission permission){
        return permissionService.add(permission);
    }

    @PostMapping("/permission/update")
    public Result update(@RequestBody Permission permission){
        return permissionService.update(permission);
    }

    @GetMapping("/permission/delete/{id}")
    public Result delete(@PathVariable("id") Long id){
        return permissionService.delete(id);
    }
}
